package com.sawyer.dao;

import com.sawyer.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserDAO {
    @Insert("insert into t_user values(#{id},#{username},#{realname},#{password},#{sex})")
    void save(User user);

    //在mybatis中传递多个参数需要参数的绑定
    @Select(" select  id,username,realname,password,sex from t_user\n" +
            "where username=#{username} and password=#{password}")
    User login(@Param("username") String username, @Param("password") String password);
}
